package de.jmda.gen.java.impl;

import static java.lang.System.lineSeparator;
import static org.junit.Assert.assertTrue;

import org.apache.log4j.Logger;
import org.junit.Test;

import de.jmda.gen.GeneratorException;
import de.jmda.gen.java.InstanceMethodGenerator;

public class JUTDefaultConstructorGenerator
{
	private final static Logger LOGGER =
      Logger.getLogger(JUTDefaultConstructorGenerator.class);

	@Test
	public void testDefaultConstructorGenerator()
			throws GeneratorException
	{
		String name = "AConstructor";
		InstanceMethodGenerator generator = new DefaultConstructorGenerator();

		generator.setName(name);
		StringBuffer generated = generator.generate();

		LOGGER.debug("generated [" + generated + "]");
		
		String expected =
				name + "()" +
				lineSeparator() +
				DefaultTypeBodyGenerator.DEFAULT_TYPE_BODY;
		
		LOGGER.debug("expected [" + expected + "]");

		assertTrue(
				"unexpected declared element [" + generated + "]",
				expected.contentEquals(generated));
	}
}